home *** CD-ROM | disk | FTP | other *** search
/ 3D Images / 3D Images.iso / programs / amiga / batchfactory / scripts / opalpaint / opal_add_photos_to_background < prev    next >
Encoding:
Text File  |  1995-01-12  |  3.0 KB  |  129 lines

  1. /* 
  2.                        OPAL ADD PHOTOS TO BACKGROUND
  3.                                By J.L. White
  4.                           ©1994 Merlin's Software
  5.  
  6.         Add Image & Resize To Fit Then Place In Photo On Background
  7.                              Opal Paint Script
  8.  
  9.  Batch Factory Batch Conversion Scripts are basically Arexx scripts that
  10. allow you to pass certain parameters to the external program you wish
  11. to use to convert the images from one format to another. You can pass
  12. five different strings from Batch Factory to the script by using the
  13. following commands:
  14.  
  15. $N = This will pass the current selected filename.
  16. $P = This will tell Batch Factory to ask for a path to save new frames to.
  17. $# = This will pass the current frame number in the script.
  18. $T = This will pass the total number of frames in the script.
  19. $A = This will pass an offset number to be used to save frames with.
  20.  
  21. NOTE: The following line is required to work as a Batch Factory Script:
  22.  
  23. PARSE=$N $P $# $A $T
  24.  
  25. */
  26.  
  27. options results
  28. call Locate_OpalPaint
  29. address "OpalPaint_Rexx"
  30. Num = 6
  31. arg InPic OutPic FrameNum AddNum TotalNum
  32. SaveNum = FrameNum + AddNum
  33. if FrameNum = 1 then do
  34.     SaveSetUp
  35.         SetPrefs 1024
  36.       AskBool "Select Save Format You Wish To Use?\n\n        Select [OK] For IFF \n\n     Select [CANCEL] For JPEG"
  37.     if Result=0 then do
  38.         AskProp 1 100 84 "Enter JPEG Compression Value (1 - 100)!"
  39.         Format = JPEG Result
  40.         end
  41.     else
  42.         Format = IFF
  43.            Saver Format
  44.     AddPage 640 400 HIRES INTERLACE
  45.     Key "j"
  46.     AskFileName 'Select Background Image To Use! RAM: '
  47.     Load result
  48.     CurrPage
  49.     PageNum = result
  50.     SecondaryPage PageNum
  51.  
  52.     PageSize
  53.     Parse var Result Width Height
  54.     X1 = Width%Num
  55.     X2 = Width - (Width%Num)
  56.     Y1 = Height%Num
  57.     Y2 = Height - (Height%Num)
  58.     key "F10"
  59.     key "."
  60.     SetPot 1 255 255 255
  61.     ActivePot 1
  62.     ColourSource PAINTPOT
  63.     SetDrawMode 3 25
  64.     AddX = 5
  65.     if Width > 400 then AddX = 10
  66.     AddY = 5
  67.     if Height > 300 then AddY = 10
  68.     SolidRect X1+10 Y1+10 X2+AddX Y2+AddY
  69.     SetDrawMode 1
  70.     SolidRect X1 Y1 X2 Y2
  71.     key "F10"
  72.     Key "j"
  73.     call open TempFile,"Ram:OAITB",W
  74.     call writeln TempFile,X1
  75.     call writeln TempFile,Y1
  76.     call writeln TempFile,X2
  77.     call writeln TempFile,Y2
  78.     call close TempFile
  79.     end
  80. else do
  81.     call open TempFile,"Ram:OAITB",R
  82.     line = readln(TempFile)
  83.     parse var line X1
  84.     line = readln(TempFile)
  85.     parse var line Y1
  86.     line = readln(TempFile)
  87.     parse var line X2
  88.     line = readln(TempFile)
  89.     parse var line Y2
  90.     call close TempFile
  91.     end
  92. Load InPic
  93. ActiveBrush 1
  94. SetDrawMode 1
  95. PageSize
  96. Parse var Result Width Height
  97. RectCut 0 0 Width Height
  98. RescaleMethod Smooth1
  99. Resize (X2-X1)-12 (Y2-Y1)-10
  100. Key "j"
  101. SetDrawMode 1
  102. ActiveBrush 1
  103. ColourSource MULTICOLOR
  104. Handle 0 0
  105. PutBrush X1+7 Y1+6
  106. if OutPic = "SAME" then
  107.     Save InPic
  108. else
  109.     Save OutPic""right(SaveNum,3,0)
  110. Key "j"
  111. if FrameNum = TotalNum then do
  112.     Key "."
  113.     SecondaryPage
  114.     DeletePage result
  115.     RestoreSetUp
  116.     Key "AMIGA w"
  117.     address command "wait 1"
  118.     address command "Delete >NIL: RAM:OAITB"
  119.     end
  120. exit
  121.  
  122. Locate_OpalPaint:
  123.     if (POS('OpalPaint_Rexx',SHOW('Ports')) = 0)
  124.     then do
  125.         address command 'run < nil: > nil: OpalPaint:OpalPaint -q'
  126.         address command 'wait 5'
  127.     end
  128. return
  129.